//
//  ListenerTableViewCell.m
//  MyListenMusicFun
//
//  Created by dllo on 16/1/20.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ListenerTableViewCell.h"

@implementation ListenerTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imgView = [[UIImageView alloc] init];
//        _imgView.backgroundColor = [UIColor cyanColor];
        [self.contentView addSubview:_imgView];
        
        self.nameLabel = [[UILabel alloc] init];
//        _nameLabel.backgroundColor =[UIColor yellowColor];
        _nameLabel.textColor = [UIColor grayColor];
        _nameLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_nameLabel];
        
        self.timeLabel = [[UILabel alloc] init];
//        _timeLabel.backgroundColor = [UIColor greenColor];
        _timeLabel.textColor = [UIColor grayColor];
        _timeLabel.font = [UIFont systemFontOfSize:15];
        _timeLabel.textAlignment = 2;
        [self.contentView addSubview:_timeLabel];
        
        self.messageLabel = [[UILabel alloc] init];
//        _messageLabel.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:_messageLabel];
        _messageLabel.numberOfLines = 0;
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    _imgView.frame = CGRectMake(10, 10, 50, 50);
    _nameLabel.frame = CGRectMake(70, 10, 100, 20);
    _timeLabel.frame = CGRectMake(self.contentView.frame.size.width - 90, 10, 80, 20);
    CGFloat h = [ListenXqTableViewCell heightWithText:_messageLabel.text width:self.contentView.frame.size.width - 70 - 10];
    _messageLabel.frame = CGRectMake(70, 30, self.contentView.frame.size.width - 70 - 10, h);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
